package com.dlwx.firefighting.adapter;

import android.content.Context;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.dlwx.firefighting.R;
import com.dlwx.firefighting.bean.HomeBean;

/**
 * Created by Administrator on 2018/4/17.
 */

public class HomeHotAdapter extends GridBaseAdapter<HomeBean.ContentBean> {
    Context context;
    public HomeHotAdapter(Context context) {
        super(context);
        this.context=context;
    }

    @Override
    public int getLayoutId() {
        return R.layout.item_product;
    }

    @Override
    public void onBindItemHolder(SuperViewHolder holder, int position) {
        HomeBean.ContentBean bean = getDataList().get(position);
        TextView tv_name=holder.getView(R.id.tv_name);
        TextView tv_price=holder.getView(R.id.tv_price);
        TextView tv_sale=holder.getView(R.id.tv_sale);
        ImageView img_product=holder.getView(R.id.img_product);
        tv_name.setText(bean.getProductName());
        tv_price.setText(context.getString(R.string.rmb)+bean.getSalePrice());
        tv_sale.setText("已售"+bean.getSaleNum()+"件");
        Glide.with(context).load(bean.getProductImageBig()).into(img_product);
    }
}
